package com.xinruke.hostels.dailymanage.controller;

import com.xinruke.hostels.common.controller.BaseController;
import com.xinruke.hostels.common.vo.ResultVO;
import com.xinruke.hostels.common.vo.query.RowsDataVO;
import com.xinruke.hostels.dailymanage.interfaces.dto.roomlock.RoomLockRecordAddDTO;
import com.xinruke.hostels.dailymanage.interfaces.dto.roomlock.RoomLockRecordQueryDetailDTO;
import com.xinruke.hostels.dailymanage.interfaces.dto.roomlock.RoomLockRecordQueryListDTO;
import com.xinruke.hostels.dailymanage.interfaces.dto.roomlock.RoomLockRecordQueryResultDTO;
import com.xinruke.hostels.dailymanage.service.RoomLockRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("/room/lock/record/")
@Api(tags = "房间锁房日志")
@Slf4j
public class RoomLockRecordController extends BaseController {

    @Autowired
    private RoomLockRecordService roomLockRecordService;

    @PostMapping(value = "/add")
    @ApiOperation("添加")
    public ResultVO<Integer> add(@RequestBody @Valid RoomLockRecordAddDTO params){
        return roomLockRecordService.add(params);
    }

    @PostMapping(value = "/list")
    @ApiOperation(value = "查询房间锁房记录列表")
    public ResultVO<RowsDataVO<RoomLockRecordQueryResultDTO>> list(@Valid @RequestBody RoomLockRecordQueryListDTO params) {
        return roomLockRecordService.list(params);
    }

    @PostMapping(value = "/detail")
    @ApiOperation(value = "查询房间锁房记录详情")
    public ResultVO<RoomLockRecordQueryResultDTO> detail(@Valid @RequestBody RoomLockRecordQueryDetailDTO params){
        return roomLockRecordService.detail(params);
    }
}
